#include "widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
    QFontComboBox *fontcombo[5];
    for(int i=0;i<5;i++){
        fontcombo[i] = new QFontComboBox(this);
    }

    fontcombo[0]->setFontFilters(QFontComboBox::AllFonts);
    fontcombo[1]->setFontFilters(QFontComboBox::ScalableFonts);
    fontcombo[2]->setFontFilters(QFontComboBox::NonScalableFonts);
    fontcombo[3]->setFontFilters(QFontComboBox::MonospacedFonts);
    fontcombo[4]->setFontFilters(QFontComboBox::ProportionalFonts);

    int ypos = 30;
    for(int i=0;i<5;i++){
        fontcombo[i]->setGeometry(10,ypos,300,30);
        ypos += 40;
    }

    connect(fontcombo[0],SIGNAL(currentIndexChanged(int)),this,SLOT(changedIndex(int)));
    connect(fontcombo[0],SIGNAL(currentFontChanged(QFont)),this,SLOT(changedFont(const QFont&)));

}

Widget::~Widget()
{
}

void Widget::changedIndex(int index){
    qDebug("index : %d",index);
}

void Widget::changedFont(const QFont &f){
    qDebug("font : %s",f.family().toStdString().c_str());
}

